<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/jquery.uploadify.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->baseUrl; ?>/css/uploadify.css"/>
<script type="text/javascript">
$(document).ready(function() {
    $("#fileUpload").uploadify({
        'swf':'<?php echo Yii::app()->baseUrl; ?>/images/uploadify/uploadify.swf',
        'cancelImg':'<?php echo Yii::app()->baseUrl; ?>/images/uploadify/uploadify-cancel.png',
        'uploader': '<?php echo Yii::app()->baseUrl; ?>/index.php?r=upload/upload',
        //'folder': '<?php echo Yii::app()->baseUrl; ?>/upload/',
        'fileTypeDesc': 'Sales ',
        'fileTypeExts': '*.xls',
        'multi': true,
		'auto':false,
        'buttonText': 'SELECT FILES',
        'displayData': 'speed',
        'simUploadLimit': 1,
		'height':30,
		'width':120,
		//'debug':true,
		'fileSizeLimit' : '1000000000KB',
        'onComplete': complete,
        'onUploadComplete' : function(file) {
          alert('The file ' + file.name + ' finished processing.');
		  processFile();
        },'onUploadError' : function(file, errorCode, errorMsg, errorString) {
            alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
        }
    });

    function complete(evnt, queueID, fileObj, response, data) {
        alert("upload complete");
    }
});


function startUpload () {
    var params = '&newFileName='+$('#photo_name').val()
    //$('#fileUpload').fileUploadSettings('scriptData', params);
   //$('#fileUpload').fileUploadStart();
	$('#fileUpload').uploadify('upload');
}
function processFile(){
   $.post("<?php echo Yii::app()->baseUrl; ?>/index.php?r=upload/processFile",null,function(data){
        //alert(data.flag);
   
   },"json");
}
</script>
